#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

// C=A*b  A长整数，b短整数
vector<int> mul(vector<int> &A, int b)
{
    vector<int> C;
    int t = 0;
    for (int i = 0; i < A.size() || t; i++)
    {
        if (i < A.size())
            t += A[i] * b;
        C.push_back(t % 10);
        t /= 10;
    }
    return C;
}
// C=A/b  A长整数，b短整数
vector<int> div(vector<int> &A, int b, int &r)
{
    vector<int> C;  //商
    r = 0;  //余数
    for (int i = A.size() - 1; i >= 0; i--)
    {
        r = r * 10 + A[i];
        C.push_back(r / b);
        r %= b;
    }  //原排序结果是高位从0开始：如结果为7654321 数组中为7654321
    reverse(C.begin(), C.end());  //让高位从数组高位开始：1234567 最后先打印高位，因为高位在最左边
    while (C.size() > 1 && C.back() == 0)
        C.pop_back();
    return C;
}

int main()
{
    string a;
    int b;
    vector<int> A;
    cin >> a >> b;
    for (int i = a.size() - 1; i >= 0; i--)
        A.push_back(a[i] - '0');

    // A*b
    auto C = mul(A, b);
    for (int i = C.size() - 1; i >= 0; i--)
        printf("%d", C[i]);
    // A/b
    int r;
    auto D = div(A, b, r);
    for (int i = D.size() - 1; i >= 0; i--)
        printf("%d", D[i]);
    cout << endl << r;
}